package com.nelson.musicplayer.base

import android.content.Intent
import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import java.lang.Class as Class

/**
 * @author nelson
 * @since 2020-07-25
 */
open abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {

    lateinit var mViewDataBinding: T

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mViewDataBinding = DataBindingUtil.setContentView<T>(this, getContentView());
        initData()
    }

    /**
     * 获取布局ID
     */
    @LayoutRes
    abstract fun getContentView(): Int

    abstract fun initData()
}